﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model.Course;
using Model.User;

public partial class ViewLecture : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LectureId"] == null) return;

        if (Teacher.get(Convert.ToInt32(Session["Person"])) != null)
            toolbarButtonDelete.Visible = true;

        Lecture c = Lecture.get(Convert.ToInt32(Session["LectureId"]));

        if (c != null)
        {
            lectureNameLabel.Text = c.getName();
            lectureNameLabel.Font.Size = FontUnit.Parse("1.5em");
            content.InnerHtml = c.getContent();
        }
    }
    protected void toolbarButtonDelete_Command(object sender, CommandEventArgs e)
    {
        Lecture l = Lecture.get(Convert.ToInt32(Session["LectureId"]));
        l.delete();

        Session["ActiveMenuButton"] = "menuButton9";
        Response.Redirect("~/CourseView/ViewCourseLogged.aspx");
    }
}